package com.wx.spider.java.feign;

import com.wx.spider.common.model.CommonResponse;
import com.wx.spider.common.pojo.db.MqErrorLog;
import com.wx.spider.common.pojo.db.WxBiz;
import com.wx.spider.common.pojo.db.WxBizNews;
import com.wx.spider.common.pojo.db.WxBizSpider;
import feign.Param;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author:feng
 * @create:2021-04-19 10:46
 */
@FeignClient("sql-ws")
public interface SqlWsClient {
    //wxbiz
    @GetMapping("/wxbiz/findAll")
    CommonResponse<List<WxBiz>> findAllWxBiz();

    @GetMapping("/wxbiz/findByBiz")
    CommonResponse<WxBiz> findWxBizByBiz(@Param("biz") String biz);


    //wxbizspider
    @PostMapping("/wxbizspider/save")
    CommonResponse<WxBizSpider> saveWxBizSpider(@Param("spider") WxBizSpider spider);

    @PutMapping("/wxbizspider/update")
    CommonResponse<WxBizSpider> updateWxBizSpider(@Param("spider") WxBizSpider spider);


    //wxbiznews
    @GetMapping("/wxbiznews/getCountByLink")
    CommonResponse<Integer> getWxBizNewsCountByLink(@RequestParam("link")String link);

    @PostMapping("/wxbiznews/save")
    CommonResponse<WxBizNews> saveWxBizNews(@Param("wxBizNews") WxBizNews wxBizNews);

    @GetMapping("/wxbiznews/findById")
    CommonResponse<WxBizNews> getWxBizNewsById(@RequestParam("id")Long id);

    @PutMapping("/wxbiznews/update")
    CommonResponse<WxBizNews> updateWxBizNews(@Param("wxBizNews") WxBizNews wxBizNews);

    //mqerrorlog

    @PostMapping("/mqerrorlog/save")
    CommonResponse<MqErrorLog> saveMqErrorLog(@Param("mqErrorLog") MqErrorLog mqErrorLog);

}
